<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="Parser,mathlib.expr.Parser,parse" name="keywords">
<title>mathlib.expr.Parser</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Parser - API Documentation';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">flashgraph API Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?mathlib/expr/Parser.html&amp;mathlib/expr/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Parser</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Parser"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">mathlib.expr</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Parser</td>
</tr>
</table>
<p></p>
 Generates a ParseTree from an array of Tokens. The parser handles a
 grammar with infix arithmetic operators and function application. Implied
 multiplication is handled in the Lexer, so that the end result is an
 expression syntax not unlike that understood by TI calculators.
    For example, the following are true in an Environment with three
    independent variables, x, y and z:
 <pre>
  xysin(x) == x * y * sin(x)
  xx == x * x
  2z(x + y) = 2 * z * (x + y)
  3max(x^2y, y^2x) == 3 * max(x^2 * y, y^2 * x)
 </pre>
  The complete grammar in BNF is as follows. Lower-case terminals such as
 <code>[addop]</code> correspond to TokenTypes.
 <pre>
  [Expression] ::= [Term]
                 | [Expression] [addop] [Term] <br/>
        [Term] ::= [Factor]
                 | [Term] [mulop] [Factor] <br/>
      [Factor] ::= [negate] [Factor]
                 | [Datum]
                 | [Datum] [pow] [Factor] <br/>
       [Datum] ::= [var]
                 | [number]
                 | [const]
                 | [Function]
                 | [lp] [Expression] [rp] <br/>
    [Function] ::= [fnname] [lp] [Arguments] [rp]
                 | [fnname] [lp] [rp] <br/>
   [Arguments] ::= [Expression]
                 | [Expression] [comma] [Arguments]
 </pre>
  <p></p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="datatype/TokenType.html" target="">mathlib.expr.datatype.TokenType</a>
</div>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#parse()">parse</a>(_tokens:Array):<a href="datatype/ParseTree.html">ParseTree</a>
</div>
<div class="summaryTableDescription">[static]
  Parse the given array of Tokens and generate a ParseTree representing
  the expression.</div>
</td><td class="summaryTableOwnerCol">Parser</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="parse()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">parse</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function parse(_tokens:Array):<a href="datatype/ParseTree.html">ParseTree</a></code><p>
  Parse the given array of Tokens and generate a ParseTree representing
  the expression.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">_tokens</span>:Array</code> &mdash; An array of Tokens representing a tokenized expression.
   This may be generated by <code>Lexer.lex()</code>.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="datatype/ParseTree.html">ParseTree</a></code></td>
</tr>
</table>
<br>
<span class="label">Throws</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code></code> &mdash; <code>SyntaxError</code>: The given expression is
   not valid. The <code>message</code> member of the exception contains
   a hint at what went wrong.
  </td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="Lexer.html#lex" target="">Lexer.lex</a>
</div>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
